package com.qidian.qc.controller;

import com.qidian.mes.pojo.qc.QcIndex;
import com.qidian.mes.pojo.qc.QcTemplate;
import com.qidian.mes.util.pojo.MESResult;
import com.qidian.qc.service.QcTemplateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author 53邹李萍
 * @Company 起点编程
 * @Time 2023/10/31 20:46
 * @Description
 */
@CrossOrigin
@RestController
@RequestMapping("/template")
public class QcTemplateController {
    @Autowired
    QcTemplateService qcTemplateService;


    @GetMapping("/list")
    public MESResult list(int page, int limit, QcTemplate template){
        return qcTemplateService.list(page,limit,template);
    }
    //编号生成
    @GetMapping("/generate")
    public MESResult generateTemplateCode(){
        return qcTemplateService.generate();
    }
    //新增
    @PostMapping("/save")
    public MESResult save(@RequestBody  QcTemplate template){
        return qcTemplateService.save(template);
    }
    //删除
    @DeleteMapping("/delete")
    public MESResult delete(String templateCode){
        return qcTemplateService.delete(templateCode);
    }
    //编辑
    @PostMapping ("/update")
    public MESResult update(@RequestBody  QcTemplate template){
        return qcTemplateService.update(template);
    }
    @GetMapping("/get")
    public MESResult get(String templateCode){
        return qcTemplateService.get(templateCode);
    }





}
